migrate(C2 wave 2a): VmMulDiv scalar multiply/divide, 4-gate green#539
Merged
Conversation
Mul and Div turned out to be pure scalar value-transforms, not memory opcodes, so they need no array/linear-memory ABI -- split out of "C2 wave 2" and landed ahead of the memory-bound wave 2b. VmMulDiv (11 exports) re-decomposed per the brain/senses split: the register-name dict stays host-side, the brain is the scalar-int value transform. Reversibility migrated as headline exports -- mul_roundtrip (Bennett ancilla c:=c+a*b, inverse c:=c-a*b) and div_reconstruct (q*b+r==a for all b, incl. divide-by-zero where r holds the original a). The intentional-flaw in-place/simple variants are migrated as value transforms with no roundtrip==id claim. Four gates green: 1/1 compile, 3322/3322 parity (mul reversibility + div reconstruction + every guard), G3 n/a (numeric transform), 1/1 assail-clean. Two new i32 ABI facts surfaced and handled: - JS a*b loses precision above 2^53, so the parity oracle uses Math.imul to stay i32-exact against i32.mul (a naive (a*b)|0 oracle would mismatch at the domain extremes). - i32.div_s TRAPS on b==0 and INT_MIN/-1 (ReScript wraps the latter), and i32.rem_s TRAPS on b==0; the brain guards both (nested-if, to avoid the unverified && codegen path) so the wasm is a total function matching ReScript's observable output. Ledger + migration-map updated: C2 wave 2a DONE; wave 2b (memory/control opcodes + structural VM) correctly scoped as needing the array ABI. https://claude.ai/code/session_01WoKhFQePiRsAj7aqnxbG8s
🔍 Hypatia Security ScanFindings: 87 issues detected
View findings[
{
"reason": "Action perpolymath/standards/.github/workflows/governance-reusable.yml@main\n needs attention",
"type": "unpinned_action",
"file": "governance.yml",
"action": "pin_sha",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Action ons/checkout@v6\n needs attention",
"type": "unpinned_action",
"file": "publish-jsr.yml",
"action": "pin_sha",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Action land/setup-deno@v2\n needs attention",
"type": "unpinned_action",
"file": "publish-jsr.yml",
"action": "pin_sha",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in affine-vscode-publish.yml",
"type": "missing_timeout_minutes",
"file": "affine-vscode-publish.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in casket-pages.yml",
"type": "missing_timeout_minutes",
"file": "casket-pages.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in casket-pages.yml",
"type": "missing_timeout_minutes",
"file": "casket-pages.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in casket-pages.yml",
"type": "missing_timeout_minutes",
"file": "casket-pages.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in ci.yml",
"type": "missing_timeout_minutes",
"file": "ci.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in ci.yml",
"type": "missing_timeout_minutes",
"file": "ci.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in ci.yml",
"type": "missing_timeout_minutes",
"file": "ci.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
}
]Powered by Hypatia Neurosymbolic CI/CD Intelligence |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
C2 wave 2a — scalar multiply/divide
MulandDivturned out to be pure scalar value-transforms, not memory opcodes, so they need no array/linear-memory ABI — split out of "C2 wave 2" and landed ahead of the memory-bound wave 2b.VmMulDiv(11 exports) re-decomposed per the brain/senses split — the register-name dict stays host-side, the brain is the scalar-int value transform. Reversibility migrated as headline exports:mul_roundtrip— Bennett ancilla (c := c + a*b, inversec := c - a*b),invert∘execute == id.div_reconstruct—q*b + r == afor allb(incl. divide-by-zero, whererholds the originala).The intentional-flaw in-place/simple variants are migrated as value transforms with no roundtrip==id claim (the source ships them to demonstrate where in-place multiply / simple divide break reversibility).
Four gates green
Two new i32 ABI facts surfaced and handled
a*bloses precision above 2^53 → the parity oracle usesMath.imulto stay i32-exact againsti32.mul(a naive(a*b)|0oracle would mismatch at the domain extremes, e.g.INT_MAX*INT_MAX).i32.div_sTRAPS onb==0andINT_MIN/-1(ReScript wraps the latter), andi32.rem_sTRAPS onb==0→ the brain guards both (nested-if, avoiding the unverified&&codegen path) so the wasm is a total function matching ReScript's observable output — never a trap.Ledger +
migration-map.jsonupdated: C2 wave 2a DONE; wave 2b (memory/control opcodes + structural VM) correctly scoped as needing the array/linear-memory ABI (the next real unblocker, also feeds the string wall).Staged-only under
proposals/idaptik/migrated/— idaptik write-gate honoured.https://claude.ai/code/session_01WoKhFQePiRsAj7aqnxbG8s
Generated by Claude Code